package uk.ac.bath.domains.IP;

import java.awt.BorderLayout;
import java.awt.Component;


/*
 * IPView.java
 * 
 */

import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import uk.ac.bath.environment.View;

/**
 * IPView provides a view of IPModel
 *
 */
public class IPView extends View {
    private IPPanel panel;

    /** Creates new form IPView */
    public IPView(final IPGetter pop) {
        setLayout(new BorderLayout());
        panel=new IPPanel(pop);

        JButton restartEval=new JButton(" RESTART ");
        restartEval.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                pop.restart();
            }
        });

        add(restartEval,BorderLayout.SOUTH);
        add(panel,BorderLayout.CENTER);
    }

    @Override
    public void setDebug(boolean selected) {
       panel.setDebug(selected);
    }

    @Override
    protected void myPaint(Graphics g) {
        panel.myPaint(g);
    }

}
